home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- *
- * NSSDC/CDF Header file for VIO
- *
- * Version 3.0, 12-Feb-92, ST Systems (STX)
- *
- * Modification history:
- *
- * V1.0 24-Jan-91, J Love Original version (for CDF V2.0).
- * V1.1 14-Mar-91, J Love Added "extend" block.
- * V2.0 6-Jun-91, J Love Changed for CACHEing (for CDF V2.1).
- * V2.1 31-Jul-91, J Love Added miscellaneous macro definitions. Added
- * fields to VFILE structure. Renamed functions
- * to avoid collisions on SGi/IRIX.
- * V3.0 12-Feb-92, J Love IBM PC port.
- *
- ******************************************************************************/
-
- #if !defined(___vio_h___)
- #define ___vio_h___
-
- /*****************************************************************************/
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
-
- /******************************************************************************
- * Miscellaneous macros.
- ******************************************************************************/
-
- #if defined(unix)
- #if !defined(memmove)
- #define memmove(dst,src,n) bcopy(src,dst,n)
- #endif
- #endif
-
- #if !defined(TRUE)
- #define TRUE (-1)
- #endif
-
- #if !defined(FALSE)
- #define FALSE 0
- #endif
-
- #if !defined(SEEK_SET)
- #define SEEK_SET 0
- #endif
-
- #if !defined(SEEK_CUR)
- #define SEEK_CUR 1
- #endif
-
- #if !defined(SEEK_END)
- #define SEEK_END 2
- #endif
-
- #if !defined(Minimum)
- #define Minimum(a,b) ((a) < (b) ? (a) : (b))
- #endif
-
- #if !defined(Maximum)
- #define Maximum(a,b) ((a) > (b) ? (a) : (b))
- #endif
-
- /******************************************************************************
- * Constants.
- ******************************************************************************/
-
- #define VIO_MAGIC_NUMBER 0x12345678 /* Used to verify that a VFILE
- structure has been passed
- to a function. */
-
- #define DEFAULT_nCACHE_BUFFERs 5 /* Default number of buffers
- in the cache (if 0 specified
- at open). */
- #define nCACHE_BUFFER_BYTEs 512 /* Size (bytes) of each cache
- buffer. */
-
- #if defined(vms)
- #define VMS_DEFAULT_nALLOCATION_BLOCKS 3 /* Allocate only 3 blocks at
- a time (override VMS default
- of 128 for fixed record
- length file). */
- #endif
-
- #define vioMAX_TRYs 10 /* Maximum number of trys on a
- read or write operation. */
-
- /******************************************************************************
- * VFILE structure.
- ******************************************************************************/
-
- struct VFILEstruct {
- long magic_number; /* Magic number for VFILE structure. */
- FILE *fp; /* file pointer */
- long offset; /* read/write position (byte offset) in file */
- long eof; /* end-of-file byte (includes what is in the cache but
- not necessarily what is physically in the file) */
- long error; /* TRUE if an error has occurred - no further access
- to the file is allowed */
- long nCACHEbuffers; /* number of CACHE buffers */
- char **CACHEbuffers; /* cache buffers */
- long *CACHEblockN; /* file block number in corresponding cache buffer */
- long *CACHEmodified; /* TRUE if cache buffer has been modified */
- long *CACHEaccessedAt; /* when buffer was last accessed (pseudo time) */
- long lastBufferNaccessed; /* contains last buffer accessed - used to speed up
- search for which buffer maps to a file block */
- long PHYeof; /* physical EOF (byte offset) of the file */
- long PHYlastBlockN; /* physical last block of the file */
- long pseudoClock; /* used to keep track of buffer access times */
- };
-
- typedef struct VFILEstruct VFILE;
-
- /******************************************************************************
- * Function prototypes.
- ******************************************************************************/
-
- #if defined(vms) | defined(__MSDOS__)
- VFILE *Vopen (char *, char *, long);
- int Vseek (VFILE *, long, int);
- long Vtell (VFILE *);
- int Veof (VFILE *);
- long Vread (void *, long, long, VFILE *);
- long Vwrite (void *, long, long, VFILE *);
- int Vclose (VFILE *);
- #endif
-
- #if defined(unix)
- VFILE *Vopen ();
- int Vseek ();
- long Vtell ();
- int Veof ();
- long Vread ();
- long Vwrite ();
- int Vclose ();
- #endif
-
- /*****************************************************************************/
-
- #endif /*___vio_h___*/
-